package com.chanyachting.emall.action.hr;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.chanyachting.emall.domain.Applicationleter;
import com.chanyachting.emall.form.ApplicationleterForm;
import com.chanyachting.emall.service.ApplicationLeterService;
import com.chanyachting.emall.serviceImpl.ApplicationLeterServiceImpl;

public class ReadJobAction extends Action {
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		ApplicationLeterService alService = new ApplicationLeterServiceImpl();
		ApplicationleterForm tForm = (ApplicationleterForm)form;
		Integer id = tForm.getId();
		
		if (id == null || id.toString().equals("")) {
			return mapping.findForward("error");
		}
		
		Applicationleter tmpLetter = new Applicationleter();
		tmpLetter.setId(id);
		tmpLetter = alService.getOneApplicationLeter(tmpLetter);
		
		tForm.setAl(tmpLetter);
		return mapping.findForward("readjob");
	}
}
